$(function() {

	setMenu("作品版式");
	var id = $('#zpId').val();
	$("#pageJinji").page({url:"getWorkData",data:{size:4,evaluateId:id},success:function(obj){
		$.each(obj.obj.content, function(i,v){
			v.createdAt = new Date(v.createdAt).Format("yyyy.MM.dd");
			v.uploadAt = new Date(v.uploadAt).Format("yyyy.MM.dd");
			v.passAt = (v.passAt == null ? "--":new Date(v.passAt).Format("yyyy.MM.dd"));
			v.len = v.bs == null ? 0 : v.bs.length;
			v.m = ((v.bs != null && v.bs.length > 0)? v.bs[0]:{});
		});
		$("#pageJinjiTabel").loadData(obj.obj);
	}});
	$('#usertemplate').on('click',function(){
		 var $form = $('<form>').attr({id : "form",method : "get",action : 'info'});
	     $form.appendTo($("#modal"));
	 	 $('<input type="hidden">').attr({name : "id",value : $('#zpId').val() }).appendTo($form);
	 	 $form.submit();
	});
 
});

function updateApply(id,state){
	if(!confirm("确定要审核这条数据吗？")) {
		return;
	}
	var idp = $('#zpId').val();
	$.ajax({
		  url: 'updateapply',
		  type: 'POST',
		  dataType : "json",
		  data: {
			  idp : idp,
			  id : id,
			  verifyState : state
		  },
		  success: function(obj){
			  if(obj.success){
				  $('#jjCount').text(obj.obj.jjCount);
				  $('#ddCount').text(obj.obj.ddCount);
				  $('#bmCount').text(obj.obj.bmCount);
				  $("#pageJinji").pageReload();
			  }
		  },
		  error : function(r) {
			}
		});
};

function updateRemark(id){
	var remarks = $("#"+id).val();
	if(remarks.length>200){
		alert("请输入200汉字以内的备注!");
		return ;
	}
	$.ajax({
		url:'updateremark',
		type:'post',
		dataType:'json',
		data:{
			id:id,
			remark:remarks
		},
		success: function(obj){
			  if(obj.success){
				  $("#pageJinji").pageReload();
			  }
		  },
		  error : function(r) {
			}
	});
}
;